<template>
    <div id="app">
        <a-button @click="ocr" type="primary" icon="plus">识别</a-button>
        <table class="report-table">
            <thead>
            </thead>
            <tbody>
                <tr>
                    <th>产品名称</th>
                    <th>{{ dataSource.productName }}</th>
                    <th>取样日期</th>
                    <th>{{ dataSource.samplingDate }}</th>
                </tr>
                <tr>
                    <td>样品来源</td>
                    <td>{{ dataSource.sampleSource }}</td>
                    <td>代表数量</td>
                    <td>{{ dataSource.representativeQuantity }}</td>
                    <td>产品原产国</td>
                    <td>{{ dataSource.countryOfOrigin }}</td>
                </tr>
                <tr>
                    <td>质量等级</td>
                    <td>{{ dataSource.qualityGrade }}</td>
                    <td>加工工艺</td>
                    <td>{{ dataSource.processingTechnology }}</td>
                    <td>检验依据</td>
                    <td>{{ dataSource.inspectionBasis }}</td>
                </tr>
                <tr>
                    <td>原料信息</td>
                    <td>{{ dataSource.rawMaterialInfo }}</td>
                </tr>
                <tr>
                    <td>检验项目/单位</td>
                    <td>检验标准值</td>
                    <td>检验结果</td>
                    <td>单项判定</td>
                </tr>
                <tr>
                    <td>气味、滋味</td>
                    <td>{{ dataSource.word1 }}</td>
                    <td>{{ dataSource.word2 }}</td>
                    <td>{{ dataSource.word3 }}</td>
                </tr>
                <tr>
                    <td>酸值(mgKOH/g)</td>
                    <td>{{ dataSource.word4 }}</td>
                    <td>{{ dataSource.word5 }}</td>
                    <td>{{ dataSource.word6 }}</td>
                </tr>
                <tr>
                    <td>过氧化值(mmol/kg)</td>
                    <td>{{ dataSource.word7 }}</td>
                    <td>{{ dataSource.word8 }}</td>
                    <td>{{ dataSource.word9 }}</td>
                </tr>
                <tr>
                    <td>水分及挥发物(%)</td>
                    <td>{{ dataSource.word10 }}</td>
                    <td>{{ dataSource.word11 }}</td>
                    <td>{{ dataSource.word12 }}</td>
                </tr>
                <tr>
                    <td>不溶性杂质(%)</td>
                    <td>{{ dataSource.word13 }}</td>
                    <td>{{ dataSource.word14 }}</td>
                    <td>{{ dataSource.word15 }}</td>
                </tr>
                <tr>
                    <td>溶剂残留(mg/kg)</td>
                    <td>{{ dataSource.word16 }}</td>
                    <td>{{ dataSource.word17 }}</td>
                    <td>{{ dataSource.word18 }}</td>
                </tr>
                <tr>
                    <td>罗维朋色泽(25.4mm)</td>
                    <td>{{ dataSource.word19 }}</td>
                    <td>{{ dataSource.word20 }}</td>
                    <td>{{ dataSource.word21 }}</td>
                </tr>
                <tr>
                    <td>检验结论</td>
                    <td>{{ dataSource.inspectionConclusion }}</td>
                </tr>
                <tr>
                    <td>备注</td>
                    <td>{{ dataSource.remarks }}</td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script>
import { postAction } from '../../api/manage'


export default {
    components: {
    },
    props: {
        dataSource: {
            type: Object,
            required: true
        }
    },
    data() {
        return {
            url: {
                ocr: "/inspectionReport/inspectionReport/ocr"
            }
        }
    },
    computed: {

    },
    created() {
    },
    methods: {
        ocr() {
            postAction(this.url.ocr, this.dataSource).then(res => {
                if (res.success) {
                    // 触发事件通知父组件更新数据
                    this.$emit('update:dataSource', res.result)
                    console.log(res.data)
                } else {
                    this.$message.error(res.message)
                }
            })
        }
    }
}
</script>